package com.project.api.sale.common;

import com.project.api.common.Http;
import com.project.api.common.wxpay.IWXPayDomain;
import com.project.api.common.wxpay.WXPayConfig;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

public class Weixin extends WXPayConfig {
    public static String APPID="wxacb1a566d582d66a";
    public static String APPSECRET="3f22dd154d01adf684e94c7b086c73f9";
    public static String MCHID="1498442352";
    public static String KEY="ZavUWSsfJTD9l1z1aTut4cmFI70c1Pkb";//商户平台秘钥key32位
    public static String NOTIfFU_URL="http://api.wensry.com/payback";//回调地址
    public static String getAccess_token(){
       String url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+APPID+"&secret="+APPSECRET;
       return  Http.sendGetRequest(url);
    }


    @Override
    public String getAppID() {
        return APPID;
    }

    @Override
    public String getMchID() {
        return MCHID;
    }

    @Override
    public String getKey() {
        return KEY;
    }

    @Override
    public InputStream getCertStream() {
        try {
            return new FileInputStream(new File("C:/api/cert/apiclient_cert.p12"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public IWXPayDomain getWXPayDomain() {
        return new Domain();
    }
}
